- content_for :title do 
  | 会员注册

header
  .logo
  
.wrap
  .index
    = form_tag('/users/update', method: 'post', remote: true ) do
      h2 完善会员信息
      span(style="color: #eb6877;font-size: 13px;") =notice
      = text_field_tag :name, @current_user.present? ? @current_user.name : '',placeholder: '姓名'
      = phone_field_tag :phone, @current_user.present? ? @current_user.phone : '',placeholder: '手机号'
      h2 class="text_left" 
        b 选择你喜欢的宠物(多选)
      ul class="clear_fix"
        - ['猫咪','狗狗','其它'].each do |value|
          li 
            = check_box_tag "pets[#{value}]",  value, @current_user.pets.include?(value),  name: 'pets[]',class: 'checkbox'
            = label_tag "pets_#{value}",  value
        = hidden_field_tag "pets[]", ""
      h2 class="text_left"
        b 地址
      ul.clear_fix.addressPicker
        - if @address.present? 
          = hidden_field_tag :address_id, @address.id
          li 
            select(name="province" data-autoselect="3" data-province="#{@address.province}" )
          li
            select(name="city" data-autoselect="3" data-city="#{@address.city}")
          li
            select(name="district" data-autoselect="3" data-district="#{@address.district}")
        - if @address.nil?
          li 
            select(name="province" data-autoselect="3" data-province="省市" )
          li 
            select(name="city" data-autoselect="3" data-city="城市")
          li 
            select(name="district" data-autoselect="3" data-district="区县")
      = text_field_tag :street, @address.present? ? @address.street : '', placeholder: '请输入具体地址'
      ins 
        | *填写后会不定期会展，培训门票赠送
      h2 class="text_left" 
        b 宠物生日日期
      = date_field_tag :pet_birth, @current_user.present? ? @current_user.pet_birth : ''
      ins 
        | *填写后会不定期发放优惠券
      input type="submit" value="提 交"

.model(style="display: none")
  .vip.vipcode
    =image_tag('success.png', size: "80x65",style: 'margin-top:40px;')
    p(style="margin-top: 30px;font-size: 20px;") 恭喜您注册会员成功!
    div class="pos_bottom"
      button(style="background: #13b5b1;color: white;" onclick="WeixinJSBridge.call('closeWindow');") 确定


div class="message" style="display: none" onclick="closeModel()"
  div class="vipcode"
    h2(style="text-align:center;margin-top: 50px; color: red") 请完善会员信息
    p id="code-show"
    div class="pos_bottom"
      button(style="background: red;color: white;" onclick="closeModel()") 确定
        
javascript:
  $(document).ready(function () {
    $('.addressPicker').distpicker();
  });
  function closeModel() {
      $(".message").hide()
  }
